import { createElement } from "react"
import EnumRouter from "@/constants/EnumRouter";

export const systemRoutes: RouteConfig = {
  path: EnumRouter.sysRoot,
  name: '系统设置',
  icon: createElement(require("@ant-design/icons").SettingOutlined),
  children: [
    {
      path: EnumRouter.sysUser,
      name: "用户管理",
      icon: createElement(require("@ant-design/icons").UserOutlined),
      component: import("./pages/user")
    },
    {
      path: EnumRouter.sysRole,
      name: "角色管理",
      icon: createElement(require("@ant-design/icons").UsergroupAddOutlined),
      component: import("./pages/role")
    },
    {
      path: EnumRouter.sysDept,
      name: "部门管理",
      icon: createElement(require("@ant-design/icons").GroupOutlined),
      component: import("./pages/dept")
    },
    {
      path: EnumRouter.sysPost,
      name: "岗位管理",
      icon: createElement(require("@ant-design/icons").IdcardOutlined),
      component: import("./pages/post")
    },
    {
      path: EnumRouter.sysLogRoot,
      name: '日志管理',
      icon: createElement(require("@ant-design/icons").FileTextOutlined),
      children: [
        {
          path: EnumRouter.sysLoginLog,
          name: "登录日志",
          icon: createElement(require("@ant-design/icons").FileTextOutlined),
          component: import("./pages/log/LoginLog")
        },
        {
          path: EnumRouter.sysOperLog,
          name: "操作日志",
          icon: createElement(require("@ant-design/icons").FileTextOutlined),
          component: import("./pages/log/OperatorLog")
        },
        {
          path: EnumRouter.sysOnlineUser,
          name: "在线用户",
          icon: createElement(require("@ant-design/icons").FileTextOutlined),
          component: import("./pages/log/OnlineUser")
        },
      ]
    },
   
    {
      path: EnumRouter.sysMenu,
      name: "菜单管理",
      icon: createElement(require("@ant-design/icons").MenuUnfoldOutlined),
      component: import("./pages/menu")
    },
    {
      path: EnumRouter.sysDataDict,
      name: "数据字典",
      icon: createElement(require("@ant-design/icons").ProfileOutlined),
      component: import("./pages/dataDict")
    },
    {
      path: EnumRouter.sysAgent,
      name: "代理商",
      icon: createElement(require("@ant-design/icons").ClusterOutlined),
      component: import("./pages/agent")
    },
    {
      path: EnumRouter.sysAccount,
      name: "账户管理",
      icon: createElement(require("@ant-design/icons").HddOutlined),
      component: import("./pages/account")
    },
    {
      path: EnumRouter.sysAdminRole,
      name: "系统角色",
      icon: createElement(require("@ant-design/icons").HddOutlined),
      component: import("./pages/adminRole")
    },
  ]
}


/**
 * 配置系统权限
 */
export const systemPermission = {
  sysRoot: {
    key: 'system'
  },
  sysUser: {
    key: 'system/user',
    addButton: 'system:user:add',
    editButton: 'system:user:edit',
    removeButton: 'system:user:remove',
  },
  sysRole: {
    key: 'system/role',
    addButton: 'system:role:add',
    editButton: 'system:role:edit',
    removeButton: 'system:role:remove',
  },
  sysDept: {
    key: 'system/dept',
    addButton: 'system:dept:add',
    editButton: 'system:dept:edit',
    removeButton: 'system:dept:remove',
  },
  sysPost: {
    key: 'system/post',
    addButton: 'system:post:add',
    editButton: 'system:post:edit',
    removeButton: 'system:post:remove',
  },
  sysMenu: {
    key: 'system/menu',
    addButton: 'system:menu:add',
    editButton: 'system:menu:edit',
    removeButton: 'system:menu:remove',
  },
  sysLogRoot: {
    key: 'system/log',
  },
  sysLoginLog: {
    key: 'system/log/login',
    removeButton: 'system:loginLog:remove',
    clearButton: 'system:loginLog:clear',
  },
  sysOperLog: {
    key: 'system/log/oper',
    removeButton: 'system:operLog:remove',
    clearButton: 'system:operLog:clear',
  },
  sysOnlineUser: {
    key: 'system/log/onlineUser',
    forceLogoutButton: 'system:onlineUser:forceLogout',
  },
  sysAccount: {
    key: "system/account",
  },
  sysDataDict: {
    key: "system/dict"
  },
}

